package com.synergy.stockflow.procure.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.synergy.stockflow.procure.entity.Vendor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.synergy.stockflow.procure.entity.SupplierPrices;
import com.synergy.stockflow.procure.mapper.SupplierPricesMapper;
import com.synergy.stockflow.procure.service.SupplierPricesService;
@Service
public class SupplierPricesServiceImpl extends ServiceImpl<SupplierPricesMapper, SupplierPrices> implements SupplierPricesService{

    @Override
    public Page<SupplierPrices> getSupplierPrices(Page<SupplierPrices> page, String supplierPricesId, String supplierpricesVendorid, String supplierpricesProductsid) {
        QueryWrapper<SupplierPrices> query = new QueryWrapper<>();
        if(supplierPricesId!=null&&supplierPricesId.length()>0){
            query.lambda().like(SupplierPrices::getSupplierPricesid,supplierPricesId);
        }
        if(supplierpricesVendorid!=null
                &&!supplierpricesVendorid.equals("全部")
                &&supplierpricesVendorid.length()>0){
            query.lambda().like(SupplierPrices::getSupplierpricesVendorid,supplierpricesVendorid);
        }
        if(supplierpricesProductsid!=null
                &&!supplierpricesProductsid.equals("全部")
                &&supplierpricesProductsid.length()>0){
            query.lambda().like(SupplierPrices::getSupplierpricesProductsid,supplierpricesProductsid);
        }
        query.lambda().orderBy(true,false,SupplierPrices::getSupplierPricesid);
        return baseMapper.selectPage(page,query);
    }
}
